<%--
  Created by IntelliJ IDEA.
  User: xxl
  Date: 2021/1/14 0014
  Time: 10:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<button onclick="addOrUpdateBtn()">新增或更改</button>
<div id="aou" style="display: none;width: 200px;height: 200px;background-color: bisque;">
    <form method="post" action="addOrUpdate.student" >
        学生ID(选填)<input type="text" name="studentId" placeholder="不填为新增"><br>
        学生姓名<input type="text" name="studentName"><br>
        班级名字<input type="text" name="classesName">
        <input type="submit">
    </form>
</div>
<table border="1">
    <tr>
        <td>学生ID</td>
        <td>学生名字</td>
        <td>班级名字</td>
        <td>操作</td>
    </tr>
    <c:forEach var="stu" items="${student}" varStatus="vs">
        <tr>
            <td>${stu.studentId}</td>
            <td>${stu.studentName}</td>
            <td>${stu.classesName}</td>
            <td><a href="#" onclick="$('#formId${vs.index}').submit()">删除</a></td>
            <td style="display: none"><form method="post" id="formId${vs.index}" action="delete.student"><input name="vs" type="text" value="${vs.current}"></form></td>
        </tr>
    </c:forEach>
</table>
</body>

<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.5.1.min.js"></script>
<script>
    function addOrUpdateBtn() {
        $("#aou").css("display","block");
    }
    function flush(){
        location.reload();
    }
    $(function() {

    });
</script>
</html>
